package de.lindenvalley.ergo;

import util.AnotherFont;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;

public class ContactActivity extends Activity implements View.OnClickListener{
	
	public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.info);
        
        AnotherFont.findTypeface((ViewGroup)getWindow().getDecorView());
        
        View buttonContactWeb = findViewById(R.id.textViewContactWeb);
        buttonContactWeb.setOnClickListener(this);
        View textContactWeb = findViewById(R.id.textViewInfoWeb);
        textContactWeb.setOnClickListener(this);
        View textContactMail = findViewById(R.id.textView3);
        textContactMail.setOnClickListener(this);
        
        View v = null;
        
        v = findViewById(R.id.switcherStart);
        v.setOnClickListener(this);
        
        v = findViewById(R.id.imageViewLogo);
        v.setOnClickListener(this);
        
//        v = findViewById(R.id.switcherRotate);
//        v.setOnClickListener(this);
//        
//        v = findViewById(R.id.switcherContact);
//        v.setOnClickListener(this);
//        
//        v = findViewById(R.id.switcherInfo);
//        v.setOnClickListener(this);
    }

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		MenuInflater inflater = getMenuInflater();
	    inflater.inflate(R.menu.menu, menu);
	    return true;

	}

	@Override
	public void onClick(View v) {
		int id = v.getId();
		Intent intent = null;
		switch (id){
		case R.id.textViewContactWeb:
			intent = new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.contact_web)));
			break;
		case R.id.textViewInfoWeb:
			intent = new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.urlLink)));
			break;
		case R.id.textView3:
			intent = new Intent(Intent.ACTION_SEND);
			intent.setType("plain/text");
			intent.putExtra(Intent.EXTRA_EMAIL, new String[]{getString(R.string.contact_mail)});
//			startActivity(Intent.createChooser(intent, getString(R.string.mailSubject)));
			break;
		case R.id.switcherStart:
			intent = new Intent(this, ErgoAppActivity.class);
//			startActivity(intent);
			finish();
			break;
		case R.id.imageViewLogo:
			intent = new Intent (Intent.ACTION_VIEW, Uri.parse(getString(R.string.urlLink)));
			break;
		}
		if (intent != null){
			startActivity(intent);
		}
		
	}
	
	

}
